//
//  XLHttpNetworking.h
//  WebSocketTest
//
//  Created by tanqilong on 16/8/11.
//  Copyright © 2016年 tanqilong. All rights reserved.
//  http网络连接
#import <Foundation/Foundation.h>

typedef enum : NSUInteger{
    XLRequestMethodGet = 1,
    XLRequestMethodPost = 2,           // content type = @"application/x-www-form-urlencoded"
} XLRequestMethod;

#import "XLNetworking.h"

@interface XLHttpNetworking : XLNetworking
/**
 *  普通网络请求,此请求需要子类写明网络地址
 *
 *  @param dic         参数
 *  @param view        显示换冲图的view
 *  @param sucBlock    成功后的回调
 *  @param cancelBlock 取消后的回调
 *  @param errorBlock  错误的回到
 *
 *  @return 类本身
 */
-(id)initWithParameters:(NSMutableDictionary *)dic IndicatorView:(UIView *)view LoadingFinished:(sucBlock)sucBlock CancelLoading:(cancelBlock)cancelBlock LoadingError:(errorBlock)errorBlock;

/**
 *  普通网络请求
 *
 *  @param url         地址
 *  @param dic         参数
 *  @param view        显示换冲图的view
 *  @param sucBlock    成功后的回调
 *  @param cancelBlock 取消后的回调
 *  @param errorBlock  错误的回到
 *
 *  @return 类本身
 */
-(id)initWithUrl:(NSString *)url Parameters:(NSMutableDictionary *)dic IndicatorView:(UIView *)view LoadingFinished:(sucBlock)sucBlock CancelLoading:(cancelBlock)cancelBlock LoadingError:(errorBlock)errorBlock;

/**
 *  普通网络请求
 *
 *  @param url         地址
 *  @param requestMethod         请求方式
 *  @param dic         参数
 *  @param view        显示换冲图的view
 *  @param sucBlock    成功后的回调
 *  @param cancelBlock 取消后的回调
 *  @param errorBlock  错误的回到
 *
 *  @return 类本身
 */
-(id)initWithUrl:(NSString *)url requestMethod:(XLRequestMethod)requestMethod Parameters:(NSMutableDictionary *)dic IndicatorView:(UIView *)view LoadingFinished:(sucBlock)sucBlock CancelLoading:(cancelBlock)cancelBlock LoadingError:(errorBlock)errorBlock;

/**
 *  获取网络加载方式
 *
 *  @return KKRequestMethod类型的
 */
- (XLRequestMethod)getRequestMethod;

/**
 *  取消网络访问
 */
-(void)cancelRequest;

/**
 *  加载之前先查看本地本地,有则不发起网络请求
 *
 *  @param url         地址
 *  @param dic         参数
 *  @param view        缓冲图
 *  @param sucBlock    成功后的回调
 *  @param cancelBlock 取消的回调
 *  @param errorBlock  失败后的回调
 *
 *  @return 类本身(建议在网络访问期间持有)
 */
-(id)initNativeWithUrl:(NSString *)url Parameters:(NSMutableDictionary *)dic IndicatorView:(UIView *)view LoadingFinished:(sucBlock)sucBlock CancelLoading:(cancelBlock)cancelBlock LoadingError:(errorBlock)errorBlock;

/**
 *  加载之前先查看本地本地,有则不发起网络请求
 *
 *  @param dic         参数
 *  @param view        缓冲图
 *  @param sucBlock    成功后的回调
 *  @param cancelBlock 取消的回调
 *  @param errorBlock  失败后的回调
 *
 *  @return 类本身(建议在网络访问期间持有)
 */
-(id)initNativeWithParameters:(NSMutableDictionary *)dic IndicatorView:(UIView *)view LoadingFinished:(sucBlock)sucBlock CancelLoading:(cancelBlock)cancelBlock LoadingError:(errorBlock)errorBlock;

/**
 *  加载之前先查看本地本地,有则先使用本地的再访问网络的
 *
 *  @param dic         参数
 *  @param view        缓冲图
 *  @param sucBlock    成功后的回调
 *  @param cancelBlock 取消的回调
 *  @param errorBlock  失败后的回调
 *
 *  @return 类本身(建议在网络访问期间持有)
 */
-(id)initNativeAndNetWithParameters:(NSMutableDictionary *)dic IndicatorView:(UIView *)view LoadingFinished:(sucBlock)sucBlock CancelLoading:(cancelBlock)cancelBlock LoadingError:(errorBlock)errorBlock;

@end
